<!DOCTYPE html>
<html>
<head>
    <title>uploadimg.html</title>

    <meta name="keywords" content="keyword1,keyword2,keyword3"></meta>
    <meta name="description" content="this is my page"></meta>
    <meta name="content-type" content="text/html; charset=UTF-8"></meta>

    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

</head>

<body>
<form enctype="multipart/form-data" method="post" action="/fileUpload">
    图片<input id="file_upload" type="file" name="file" onchange="imgChange(this)"/>
    <input type="submit" value="上传"/>

</form>
<img id="uploaded_images" src="" style="width: 200px; height: 300px;" />
</body>
<script type="text/javascript">
    <!--显示需要上传图片的所路途-->
    // 选择图片显示
    function imgChange(obj) {
    // 获取点击的文本框
        var file = document.getElementById("file_upload");
        var imgUrl = window.URL.createObjectURL(file.files[0]);
        var img = document.getElementById('uploaded_images');
        img.setAttribute('src', imgUrl); // 修改img标签src属性值
    };

</script>
</html>